<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>门店管理</title>
    <#include "/common/link.ftl">
    <script>
        $(function () {
            $('.input-date').datetimepicker({
                format:'yyyy-mm-dd', //格式
                language:'zh-CN', //中文
                autoclose: true,//选择后自动关闭
                //showMeridian:true, //是否显示上下午
                minView:2,//精确到哪位
            });

            //模态框
            $('.btn-details').click(function () {
                var $btn = $(this);
                console.log($btn);
                // var data = $btn.attr('data-JSON'); //$btn.data('data-JSON');

                var data = $btn.data('details');
                console.log(data);
                $('input[name]').val('');
                if (data){
                //  $('input[name=id]').val(data.id);
                    $('input[name=name1]').val(data.name);
                    $('input[name=intro1]').val(data.intro);
                    $('p[name=scope1]').html(data.scope);
                    $('input[name=tel1]').val(data.tel);
                    $('input[name=address1]').val(data.address);
                    $('input[name=openDate1]').val(data.openDate);
                    $('input[name=licenseImg1]').val(data.licenseImg);
                    $('input[name=licenseNumber1]').val(data.licenseNumber);
                    $('input[name=legalName1]').val(data.legalName);
                    $('input[name=legalTel1]').val(data.legalTel);
                    $('input[name=legalIdcard1]').val(data.legalIdcard);
                    $('input[name=mainStore1]').val(data.mainStore);
                }
                //显示模态框
                $('#myModal').modal('show')
            })

        })
    </script>
</head>
<body class="hold-transition skin-black sidebar-mini">
<#--模态框-->
<form>
    <div class="modal fade" tabindex="-1" role="dialog" id="myModal">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">门店详情</h4>
                </div>
                <div class="modal-body">

                        <input type="hidden" name="id">
                        <div>门店名称:<input type="text" class="form-control" name="name1"></div><br>
                        <div style="word-break:break-all">门店介绍:<input type="text" class="form-control" name="intro1"></div><br>
                        <div>经营范围:<p name="scope1"></p></div><br>
                        <div>门店电话:<input type="text" class="form-control" name="tel1"></div><br>
                        <div>门店地址:<input type="text" class="form-control" name="address1"></div><br>
                        <div>经营日期:<input type="text" class="form-control" name="openDate1"></div><br>
                        <div>营业执照照片:<input type="text" class="form-control" name="licenseImg1"></div><br>
                        <div>营业执照号码:<input type="text" class="form-control" name="licenseNumber1"></div><br>
                        <div>法人姓名:<input type="text" class="form-control" name="legalName1"></div><br>
                        <div>法人电话:<input type="text" class="form-control" name="legalTel1"></div><br>
                        <div>法人身份证:<input type="text" class="form-control" name="legalIdcard1"></div><br>
                        <div>门店性质:<input type="text" class="form-control" name="mainStore1"></div><br>


                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</form>
<div class="wrapper">
    <#include "/common/navbar.ftl">
    <!--菜单回显-->
    <#assign currentMenu="business"/>
    <#include "/common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>门店管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <div style="margin: 20px 0px 0px 10px">
                    <form class="form-inline" id="searchForm" action="/business/list" method="post" >
                        <input type="hidden" name="currentPage" id="currentPage" value="1">
                                <div class="form-group">
                                    <label for="name">门店名称：</label>
                                    <input type="text" class="form-control" name="name" value="${qo.name!}"
                                           placeholder="请输入门店名称">
                                </div>
                                <div class="form-group">
                                    <label for="scope">经营范围：</label>
                                    <input type="text" class="form-control" name="scope" value="${qo.scope!}"
                                           placeholder="请输入经营范围">
                                </div>
                                <div class="form-group">
                                    <label for="tel">门店联系方式：</label>
                                    <input type="text" class="form-control" name="tel" value="${qo.tel!}"
                                           placeholder="请输入门店联系方式">
                                </div>
                                <div class="form-group">
                                    <label for="legalName">根据法人查询：</label>
                                    <input type="text" class="form-control" name="legalName" value="${qo.legalName!}"
                                           placeholder="请输入法人姓名">
                                </div>

                                <br/>
                                <br/>
                                <div class="form-group">
                                    <label>经营日期查询：</label>
                                    <input placeholder="请输入开始日期" type="text" class="form-control input-date" name="openDate" value="${((qo.openDate)?string("yyyy-MM-dd"))!}"/> -
                                    <input placeholder="请输入结束日期" type="text" class="form-control input-date" name="endDate" value="${((qo.endDate)?string("yyyy-MM-dd"))!}"/>
                                </div>

                                <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span> 查询</button>

                                <a href="/business/input" class="btn btn-success">
                                    <span class="glyphicon glyphicon-plus"></span> 添加
                                </a>
                    </form>

                </div>
                <div class="box-body table-responsive">
                <table class="table table-hover table-bordered table-striped">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>门店名称</th>
                        <th>门店电话</th>
                        <th>门店地址</th>
                        <th>经营时间</th>
                        <th>门店性质</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <#list pageInfo.list as b >
                        <tr>
                            <td>${b_index+1}</td>
                            <td>${b.name!}</td>
                            <td>${b.tel!}</td>
                            <td>${b.address!}</td>
                            <td>${((b.openDate)?string("yyyy-MM-dd"))!}</td>
                            <td>${b.store!}</td>
                            <td>
                                <a class="btn btn-details" data-details='${b.toJSON()}'>
                                    <span class="glyphicon glyphicon-info-sign"></span>门店详情
                                </a>
                                <a href="/business/input?id=${b.id}" class="btn btn-info btn-xs">
                                    <span class="glyphicon glyphicon-pencil"></span> 编辑
                                </a>
                            </td>
                        </tr>
                    </#list>
                    </tbody>
                </table>
                <#include "/common/page.ftl">
                </div>
            </div>
        </section>
    </div>
    <#include "/common/footer.ftl">
</div>


</body>
</html>
